import request from "@/utils/request";
import type { Trademark } from "./type";
import type { ResponseData, PageData } from "@/api/type";

enum API {
    TRADEMARK_URL = "/admin/product/baseTrademark/",
    SAVE_TRADEMARK_URL = "/admin/product/baseTrademark/save",
    DELETE_TRADEMARK_URL = "/admin/product/baseTrademark/remove/",
    UPDATE_TRADEMARK_URL = "/admin/product/baseTrademark/update",

}

const reqHasTrademark = (pageNo: number, pageSize: number,) => {
    return request.get<any, ResponseData<PageData<Trademark>>>(API.TRADEMARK_URL + `${pageNo}/${pageSize}`)
}

const reqSaveTrademark = (trademark: Trademark) => {
    return request.post<any, ResponseData<string>>(API.SAVE_TRADEMARK_URL, trademark)
}


const reqDeleteTrademark = (id: number) => {
    return request.delete<any, ResponseData<string>>(API.DELETE_TRADEMARK_URL + `${id}`)
}


const reqUpdateTrademark = (trademark: Trademark) => {
    return request.put<any, ResponseData<string>>(API.UPDATE_TRADEMARK_URL, trademark)
}



export {
    reqHasTrademark,
    reqSaveTrademark,
    reqDeleteTrademark,
    reqUpdateTrademark
}